version: "3.8"

services:
  mongo:
    image: mongo:4.2.19
    environment:
      - MONGO_INITDB_ROOT_USERNAME=root
      - MONGO_INITDB_ROOT_PASSWORD=123456
    volumes:
      - /data/mongo:/data/db
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "27017:27017"
    networks:
      - "default"
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints: [node.role == manager]
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
        window: 120s
networks:
  default:
    external:
      name: traefik_default